<div class="page_function">
  <div class="info">
    <h3>表单管理</h3>
    <small>可以添加或者修改表单功能</small> </div>
  <div class="exercise"> 
   <a href="__APP__/form/index">表单列表</a>
   <?php if(model('user_group')->model_power('form','add')){ ?>
   <a href="__APP__/form/add">表单添加</a>
   <?php } ?>
   <?php if(model('user_group')->model_power('form','in')){ ?>
   <a href="javascript:;" onclick="form_in('__URL__/in')">导入表单</a>
   <?php } ?>
   </div>
</div>
<div class="page_main">
  <div class="page_table table_list">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="10%"><center>ID</center></th>
        <th width="30%">表单</th>
        <th width="30%"><center>表单名</center></th>
        <th width="30%"><center>表单操作</center></th>
      </tr>
      <!--foreach:{$list $vo}-->
      <tr>
        <td><center>{$vo.id}</center></td>
        <td>{$vo.name}</td>
        <td><center>{$vo.table}</center></td>
        <td><center>
        <?php if(model('user_group')->model_power('form','field')){ ?>
        <a href="__URL__/field_list/id-{$vo.id}">字段管理</a>
        <?php } ?>
        <?php if(model('user_group')->model_power('form','edit')){ ?>
        &nbsp;&nbsp;<a href="__URL__/edit/id-{$vo.id}">修改</a>
        <?php } ?>
        <?php if(model('user_group')->model_power('form','out')){ ?>
         &nbsp;&nbsp;<a  href="javascript:void(0);" onclick="out('{$vo.id}')">导出</a>
        <?php } ?>
        <?php if(model('user_group')->model_power('form','del')){ ?>
         &nbsp;&nbsp;<a href="javascript:void(0);" onclick="del('{$vo.id}',this)">删除</a>
        <?php } ?></center></td>
      </tr>
      <!--{/foreach}-->
    </table>
  </div>
</div>
<script>
loadmenu();
function loadmenu(){
	var doc = window.parent.document;
	$.get('__APP__/menu/form?load=1', function(result){
           $(doc).contents().find("#nav").html(result);
     });
}
function form_in(url) {
	urldialog({
	title:'表单导入',
	url:url
	});
	loadmenu();
};
function out(id) {
	ajaxpost({
		name:'导出的文件将在网站目录下的"data/form"中，请自行下载！',
		url:"__URL__/out",
		data:{id:id},
		tip:1
	});
};
//删除
function del(id,obj) {
	var obj;
	ajaxpost({
		name:'删除模型后会同时删除模型表和内容! ',
		url:"__URL__/del",
		data:{id: id},
		tip:1,
		success:function(){
			$(obj).parent().parent().parent().remove();
			loadmenu();
		}
	});
}
</script>